/********************************************/
  // Creation History
  // --------------------------------------------------------------
  //	Company:			HTHK
  //	NAME:				EmployeeProcess.java
  //    Title   :			some operations about Employee such as 
  //                        CreateBean,Insert,Update,Delete,Find  
  //	FUNCTION:			
  //	BY:					Beyes xia
  //	DATE:				16/12/2003
  // --------------------------------------------------------------
/*********************************************/

package tss.staffproject;

import com.ffpc.sql.*;

import java.sql.*;
import java.util.Vector;

/**
 * A Class class.
 * <P>
 * @author HTHK
 */
public class EmployeeProcess
{
    public static EmployeeBean createBean()
    {
        return new Employee();
    }

    public static  int insert(Connection con, EmployeeBean employeeBean)
      throws DataException
    {
        Employee employee = (Employee)employeeBean;
        employee.setConnection(con);
        return employee.insert();
    }

    public static int update(Connection con, EmployeeBean employeeBean)
      throws DataException
    {
        Employee employee = (Employee)employeeBean;
        employee.setConnection(con);
        return employee.update();
    }

    public static int delete(Connection con, EmployeeBean employeeBean)
      throws DataException
    {
        Employee employee = (Employee)employeeBean;
        employee.setConnection(con);
        return employee.delete();
    }

    public static EmployeeBean[] find(Connection con, EmployeeBean employeeBean)
      throws DataException
    {
	  Employee employee = (Employee)employeeBean;
        BaseSqlCommand buc = new BaseSqlCommand(con);
        Vector rows = buc.find(employee);
        EmployeeBean[] beans = new Employee[rows.size()];
        for (int i=0;i<rows.size();i++)
        {
            Employee bean = new Employee();
            bean.setColumns((Column[])rows.get(i));
            beans[i] = bean;
        }
        return beans;
    }
}


